package com.example

fun main() {
    /*val res = listOf(3,2,1).first().let {
        it*it
    }
    println(res)*/

//    println(formate(null))
    //run后面使用小括号!!!
    val res = "The name is tony".run(::isLong)
    println(res)

    "The name is tony"
        .run(::isLong)
        .run(::message)
        .run(::println)
}

/*
fun formate(s:String?):String{
    return s?.let {
        "welcome to China s"
    } ?: "what's name"
}*/


fun isLong(name:String) = name.length >= 10

fun message(isLong:Boolean):String {
    return if(isLong) {
        "this is true"
    }else {
        "this is false"
    }
}